﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ProjectManage2.Database.Migrations.Migrations
{
    public partial class v101 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "sys_dictionary",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "Id主键"),
                    DictionaryType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "字典类型"),
                    DictionaryTypeName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "字典类型描述"),
                    DictionaryValue = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "字典值"),
                    DictionaryDescription = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "字典值描述"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
                    ModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "更新时间"),
                    Creater = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建人"),
                    CreatedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "创建者名称"),
                    Modifier = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改人"),
                    ModifiedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "修改者名称")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_dictionary", x => x.Id);
                },
                comment: "数据字典表");

            migrationBuilder.CreateTable(
                name: "sys_menu",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "Id主键"),
                    AppCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "应用编号"),
                    MenuCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "菜单编码"),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "菜单名称"),
                    Icon = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "菜单图标"),
                    MenuType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false, comment: "菜单类别"),
                    Url = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true, comment: "对应页面Url"),
                    ParentCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
                    ModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "更新时间"),
                    Creater = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建人"),
                    CreatedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "创建者名称"),
                    Modifier = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改人"),
                    ModifiedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "修改者名称")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_menu", x => x.Id);
                },
                comment: "菜单表");

            migrationBuilder.CreateTable(
                name: "sys_role",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "Id主键"),
                    RoleCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "角色编码"),
                    RoleName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "角色名称"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
                    ModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "更新时间"),
                    Creater = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建人"),
                    CreatedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "创建者名称"),
                    Modifier = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改人"),
                    ModifiedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "修改者名称")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_role", x => x.Id);
                },
                comment: "角色表");

            migrationBuilder.CreateTable(
                name: "sys_rolemenu",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "Id主键"),
                    RoleCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "角色"),
                    MenuCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "菜单"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
                    ModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "更新时间"),
                    Creater = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建人"),
                    CreatedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "创建者名称"),
                    Modifier = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改人"),
                    ModifiedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "修改者名称")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_rolemenu", x => x.Id);
                },
                comment: "角色菜单关系表");

            migrationBuilder.CreateTable(
                name: "sys_user",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Account = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "账号"),
                    Password = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "密码"),
                    Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "姓名"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
                    ModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "更新时间"),
                    CreatedName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建者名称"),
                    ModifiedName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改者名称")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_user", x => x.Id);
                },
                comment: "用户表");

            migrationBuilder.CreateTable(
                name: "sys_userrole",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false, comment: "Id主键"),
                    Account = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "用户"),
                    RoleCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false, comment: "角色"),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "创建时间"),
                    ModifiedTime = table.Column<DateTime>(type: "datetime2", nullable: true, comment: "更新时间"),
                    Creater = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "创建人"),
                    CreatedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "创建者名称"),
                    Modifier = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true, comment: "修改人"),
                    ModifiedName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "修改者名称")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sys_userrole", x => x.Id);
                },
                comment: "用户角色关系表");

            migrationBuilder.InsertData(
                table: "sys_dictionary",
                columns: new[] { "Id", "CreatedName", "CreatedTime", "Creater", "DictionaryDescription", "DictionaryType", "DictionaryTypeName", "DictionaryValue", "ModifiedName", "ModifiedTime", "Modifier" },
                values: new object[,]
                {
                    { new Guid("0970f12c-62df-4a1d-a7c7-922af58ae9be"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 199, DateTimeKind.Local).AddTicks(7487), "Admin", "页面", "MenuType", "菜单类型", "1", null, null, null },
                    { new Guid("1fd96454-f501-423c-82fb-c2673bf34f24"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 199, DateTimeKind.Local).AddTicks(7465), "Admin", "否", "YesOrNo", "是否", "0", null, null, null },
                    { new Guid("36a5d767-441b-4a20-9ca1-5e22019a2101"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 199, DateTimeKind.Local).AddTicks(7481), "Admin", "是", "YesOrNo", "是否", "1", null, null, null },
                    { new Guid("3b4efa7e-1410-4c8c-8f5d-f00b91c55588"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 199, DateTimeKind.Local).AddTicks(7490), "Admin", "按钮", "MenuType", "菜单类型", "2", null, null, null },
                    { new Guid("9ab0db6a-4cd3-4983-bfa2-e1ede009b1c1"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 199, DateTimeKind.Local).AddTicks(7484), "Admin", "目录", "MenuType", "菜单类型", "0", null, null, null },
                    { new Guid("eca95e32-bfd5-4629-8dbf-0b95749aaaa1"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 199, DateTimeKind.Local).AddTicks(7495), "Admin", "全局", "AppCode", "应用", "0", null, null, null }
                });

            migrationBuilder.InsertData(
                table: "sys_menu",
                columns: new[] { "Id", "AppCode", "CreatedName", "CreatedTime", "Creater", "Icon", "MenuCode", "MenuType", "ModifiedName", "ModifiedTime", "Modifier", "Name", "ParentCode", "Url" },
                values: new object[,]
                {
                    { new Guid("02abb8a1-c7b4-4546-b1de-a70d2970b8eb"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5059), "Admin", "fa-user", "1101", "1", null, null, null, "用户管理", "11", "/System/User" },
                    { new Guid("0fb81879-aa0e-448c-92a3-76db10be9a88"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5069), "Admin", "fa-rocket", "1102", "1", null, null, null, "角色管理", "11", "/System/Role" },
                    { new Guid("5ef9e1f6-77a9-4ff0-bb3d-185b215a496c"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5072), "Admin", "fa-cogs", "11", "0", null, null, null, "系统管理", null, null },
                    { new Guid("66d7c892-b261-4e10-846b-b7aed63f0189"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5075), "Admin", "fa-flag", "10", "1", null, null, null, "主页", null, "/" },
                    { new Guid("7f4a3a81-1246-4c5d-8fdc-418af49afd51"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5078), "Admin", "fa-window-restore", "1105", "1", null, null, null, "角色菜单", "11", "/System/RoleMenu" },
                    { new Guid("9252f813-ba21-4609-96bb-9263e2ce0ada"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5084), "Admin", "fa-book", "1103", "1", null, null, null, "数据字典", "11", "/System/Dictionary" },
                    { new Guid("d3ea16c7-f9eb-4cab-93b0-7a2aa773184c"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5087), "Admin", "fa-list", "1104", "1", null, null, null, "菜单管理", "11", "/System/Menu" },
                    { new Guid("f941100e-4b48-402d-81b0-09feba588d8d"), "0", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 201, DateTimeKind.Local).AddTicks(5090), "Admin", "fa-tree", "1106", "1", null, null, null, "用户角色", "11", "/System/UserRole" }
                });

            migrationBuilder.InsertData(
                table: "sys_role",
                columns: new[] { "Id", "CreatedName", "CreatedTime", "Creater", "ModifiedName", "ModifiedTime", "Modifier", "RoleCode", "RoleName" },
                values: new object[] { new Guid("0a5096cc-0635-4c88-bf48-b2013a3612be"), "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 202, DateTimeKind.Local).AddTicks(6981), "Admin", null, null, null, "SystemAdmin", "系统管理员" });

            migrationBuilder.InsertData(
                table: "sys_user",
                columns: new[] { "Id", "Account", "CreatedName", "CreatedTime", "ModifiedName", "ModifiedTime", "Name", "Password" },
                values: new object[] { new Guid("7a8045ec-29c4-44fc-8d6a-356262ca35c5"), "Admin", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 205, DateTimeKind.Local).AddTicks(653), null, null, "管理员", "a0994336c114bf9d0fa8c3a70c84ba2c" });

            migrationBuilder.InsertData(
                table: "sys_userrole",
                columns: new[] { "Id", "Account", "CreatedName", "CreatedTime", "Creater", "ModifiedName", "ModifiedTime", "Modifier", "RoleCode" },
                values: new object[] { new Guid("ed6cee05-38e9-4533-a394-4072670ada4d"), "Admin", "管理员", new DateTime(2023, 4, 11, 23, 29, 2, 206, DateTimeKind.Local).AddTicks(2622), "Admin", null, null, null, "SystemAdmin" });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "sys_dictionary");

            migrationBuilder.DropTable(
                name: "sys_menu");

            migrationBuilder.DropTable(
                name: "sys_role");

            migrationBuilder.DropTable(
                name: "sys_rolemenu");

            migrationBuilder.DropTable(
                name: "sys_user");

            migrationBuilder.DropTable(
                name: "sys_userrole");
        }
    }
}
